<template>
  <div>
    <van-cell-group inset>
        <van-field v-model="mobile" label="绑定手机号" placeholder="请输入手机号" />
        <van-field v-model="password" label="输入密码" placeholder="请输入输入密码" />
        </van-cell-group>
        <van-button type="default" @click="submit">默认按钮</van-button>
  </div>
</template>

<script>
export default {
    data(){
        return{
            mobile:"",
            uid:"",
            token:"",
            password:""
        }
    },
    methods:{
        submit(){
            var data = {
                'mobile':this.mobile,
                'uid':this.$route.query.uid,
                'token':this.$route.query.token,
                'password':this.password
            }
            this.axios.post('/bingMobile',data)
            .then(resp=>{
                console.log(resp)
                if(resp.data.code == 200){
                    alert(resp.data.msg)
                    localStorage.setItem('token',resp.data.token)
                    localStorage.setItem('userid',resp.data.userid)
                    this.$router.push('/login')
                }else{
                    alert('添加失败')
                }
            })
        }
    },
    mounted(){

    }
}
</script>

<style>

</style>